package com.ignitetest.datanode;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by User on 2017/5/17.
 */
public class DataNodeJdbcTest {
    public  static void main(String[] args) throws SQLException, ClassNotFoundException {
        // Register JDBC driver.
        Class.forName("org.apache.ignite.IgniteJdbcDriver");
// Open JDBC connection (cache name is not specified, which means that we use default cache).
        Connection conn = DriverManager.getConnection("jdbc:ignite:cfg://cache=personCache@file:///E:/workspace_new3/ignitetest/ignite_datanode_test2/src/main/resources/ignite-jdbc.xml");
// Query names of all people.
        ResultSet rs = conn.createStatement().executeQuery("select id from Person limit 10000");
        while (rs.next()) {
            try {
                String id = rs.getString(1);
                System.out.println(id);
            } catch (SQLException e) {
                e.printStackTrace();
            }

        }
        rs.close();
        conn.close();
    }
}
